package com.example.ios_del1.myapplicationtest;

import android.util.Log;
import android.widget.Toast;

import java.security.MessageDigest;

public class MD5Util {

	public final static String md5(String pwd) {
        //锟斤拷锟节硷拷锟杰碉拷锟街凤拷
        char md5String[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                'A', 'B', 'C', 'D', 'E', 'F' };
        try {
            byte[] btInput = pwd.getBytes();

            MessageDigest mdInst = MessageDigest.getInstance("MD5");
            mdInst.update(btInput);
            byte[] md = mdInst.digest();
            int j = md.length;
            char str[] = new char[j * 2];
            int k = 0;
            for (int i = 0; i < j; i++) {   //  i = 0
                byte byte0 = md[i];  //95
                str[k++] = md5String[byte0 >>> 4 & 0xf];    //    5  
                str[k++] = md5String[byte0 & 0xf];   //   F
            }
            Log.e("222",new String(str));
            //锟斤拷锟截撅拷锟斤拷锟斤拷锟杰猴拷锟斤拷址锟斤拷锟�
            return new String(str);
             
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
